using System;
using System.Collections.Generic;

using System.Text;

using Mud.Common.Physical;

namespace Mud.Client
{

    /// <summary>
    /// Represents a game object.
    /// </summary>
    public class GameObject
    {

        /// <summary>
        /// Object name.
        /// </summary>
        public string Name
        {
            get { return _name; }
            internal set { _name = value; OnObjectChanged(); }
        }
        private string _name;

        /// <summary>
        /// Object id.
        /// </summary>
        public int ObjectId
        {
            get { return _objectId; }
        }
        private int _objectId;

        /// <summary>
        /// Object location.
        /// </summary>
        public Location Location
        {
            get { return _location; }
            internal set { _location = value; OnObjectChanged(); }
        }
        private Location _location;

        /// <summary>
        /// Objects orientation.
        /// </summary>
        public Orientation Orientation
        {
            get { return _orientation; }
            internal set { _orientation = value; OnObjectChanged(); }
        }
        private Orientation _orientation;


        /// <summary>
        /// Name of the objects area.
        /// </summary>
        public string CurrentAreaName
        {
            get { return _currentAreaName; }
            internal set { _currentAreaName = value; OnObjectChanged(); }
        }
        private string _currentAreaName;

        /// <summary>
        /// True if the object should be displayed.
        /// </summary>
        public bool Visible
        {
            get { return _visible; }
            internal set { _visible = value; OnObjectChanged(); }
        }
        private bool _visible = true;

        public GameObject(int objectId)
        {
            _objectId = objectId;
        }

        #region Object change event raising

        public delegate void GameObjectChangedHandler(GameObject o);

        /// <summary>
        /// Raised when the object changes.
        /// </summary>
        public event GameObjectChangedHandler GameObjectChanged;

        /// <summary>
        /// Raises the GameObjectChanged event.
        /// </summary>
        protected virtual void OnObjectChanged()
        {
            if (GameObjectChanged != null)
                GameObjectChanged(this);
        }
        #endregion

    }
}
